

const p = 'The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?';
console.log(p.replace('dog', 'monkey'));

// match() 方法检索返回一个字符串匹配正则表达式的结果。
const paragraph = 'The quick brown fox jumps over the lazy dog. It barked.';
const regex = /[A-Z]/g;
const found = paragraph.match(regex);

console.log(found);
function main() {
  const promise = new Promise(function(resolve, reject) {
    let arr = []
    for (let i = 0; i < 5; i++) {
      arr.push(i)
    }
    resolve(arr)
  })
  return promise
}
const result =  main().then(function(data) {
  console.log('data:' + data)
  return data
})
// let result = data
console.log('result:' + result.)
// function foo() {
//   return main().then(function(data) {
//     let result = []
//     for(let i = 0; i < data.length; i++) {
//       result.push(data[i])  
//     }
//     return result
//   })
// }
// const foo1 = foo().
// console.log('foo:' + foo1);
// result.then(function(res) {
//   console.log('res:' + res)
// })

// const name = 'adc'
// const str = name.toString()
// console.log('str:' + str)

